import React, {Component} from 'react';
import {Relax} from 'iflux2';
import {
  Form, 
  Checkbox, 
  Tooltip, 
  Icon
} from 'antd';
import noop from 'util/noop';
const FormItem = Form.Item;

@Relax
export default class TypeSet extends Component{
  static defaultProps = {
    threeMonthsSales: 0,
    onSetting: noop
  }
  render() {
    let {layoutProps, threeMonthsSales} = this.props;
    return (
      <FormItem label='商品销售量显示设置' {...layoutProps}>
        <Checkbox onChange={this.handleChange} checked={threeMonthsSales == 1}>近三个月商品销量</Checkbox>
          <Tooltip 
            placement="bottom" 
            title="三个月销量：统计商品近三个月的商品销量。（统计前一天往前三个月的已支付订单的商品的销量，代客下单只要已支付，也会统计；商品退货退款不计算在内）">
            <span className="help-tips">
              <Icon type="info-circle"/>
            </span>
          </Tooltip>
      </FormItem>
    )
  }

  handleChange = (e) => {
    this.props.onSetting({threeMonthsSales:e.target.checked ? 1 : 0})
  }
}